@extends('admin.container')
@section('c-body')
    <div class="am-g">
        <div class="am-u-sm-12 am-u-md-6">
            <div class="am-btn-toolbar">
                <div class="am-btn-group am-btn-group-xs">
                    <a href="{{ route('admin.article.create') }}" class="am-btn am-btn-default"><span class="am-icon-plus"></span> 新增</a>
                </div>
            </div>
        </div>

    </div>

    <div class="am-g">
        <div class="am-u-sm-12">
            <form class="am-form">
                <table class="am-table am-table-striped am-table-hover table-main">
                    <thead>
                    <tr>
                        <th class="table-id">ID</th>
                        <th class="table-title">标题</th>
                        <th class="table-type">类别</th>
                        <th class="table-author am-hide-sm-only">作者</th>
                        <th class="table-date am-hide-sm-only">修改日期</th>
                        <th class="table-set">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    @forelse($articles as $article)
                        <tr>
                            <td>{{ $article->id }}</td>
                            <td>{{ $article->title }}</td>
                            <td>{{ $article->category->display_name }}</td>
                            <td class="am-hide-sm-only">{{ $article->author->user }}</td>
                            <td class="am-hide-sm-only">{{ $article->updated_at }}</td>
                            <td>
                                <div class="am-btn-toolbar">
                                    <div class="am-btn-group am-btn-group-xs">
                                        <a class="am-btn am-btn-default am-btn-xs am-text-secondary" href="{{ route('admin.article.edit', [$article->id]) }}"><span
                                                    class="am-icon-pencil-square-o"></span> 编辑
                                        </a>
                                        <button data-item-id="{{ $article->id }}" data-post-url="{{ route('admin.article.destroy', [$article->id]) }}" class="op-delete am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only"><span
                                                    class="am-icon-trash-o"></span> 删除
                                        </button>
                                    </div>
                                </div>
                            </td>
                        </tr>
                    @empty
                        <tr>
                            <td colspan="6">没有文章数据&nbsp;&nbsp;<a href="{{route('admin.article.create')}}">请添加</a>
                            </td>
                        </tr>
                    @endforelse
                    </tbody>
                </table>
                <div class="am-cf">
                    {!! $articles->render() !!}
                        共 {{$articles->total()}} 条记录
                </div>
                <hr>
                <p>注：.....</p>
            </form>
        </div>

    </div>
@stop
@section('c-foot')
    <script>
        AdminTools.csrfToken = "{{ csrf_token() }}";
    </script>
@stop
